import 'package:lepig/common/config/theme.dart';
import 'package:flui/flui.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class Withdraw extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _WithdrawState();
  }
}

class _WithdrawState extends State<Withdraw> {
  ShapeBorder buttomShape = const RoundedRectangleBorder(
      side: BorderSide.none,
      borderRadius: BorderRadius.all(Radius.circular(10)));

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        elevation: 0,
        title: new Text("提现"),
        actions: <Widget>[
          FlatButton(
            child: new Icon(Icons.settings),
            onPressed: () {
              Navigator.of(context).pushNamed("/setting");
            },
          )
        ],
      ),
      body:new SingleChildScrollView(
        child: new Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
            new Column(
              children: <Widget>[
                _accountCard(),
                new SizedBox(
                  height: 10.0,
                ),

                _withdrawCard(),
                new SizedBox(
                  height: 10.0,
                ),
                _explainCard(),
              ],
            ),
            new SizedBox(height: 50.0,),
            new Padding(
              padding: EdgeInsets.only(left: 40, right: 40, bottom: 20.0),
              child: new SizedBox(
                width: double.infinity,
                child: new FlatButton(
                    shape: buttomShape,
                    color: curColor,
                    onPressed: () {},
                    child: new Text(
                      "立即提现",
                      style:
                      TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold),
                    )),
              ),
            )
          ],
        ),
      ),
    );
  }

  //账户
  Widget _accountCard() {
    return new Padding(
      child: new Container(
        child: new Row(
          children: <Widget>[
            new Column(
              children: <Widget>[
                new Text(
                  "可提现金额",
                  style: TextStyle(fontSize: 15.0),
                ),
                new SizedBox(
                  height: 10,
                ),
                new Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    new Text(
                      "0.02",
                      style: TextStyle(
                          fontWeight: FontWeight.bold, fontSize: 24.0),
                    ),
                    new SizedBox(
                      width: 5,
                    ),
                    new Text("元"),
                  ],
                )
              ],
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.center,
            ),
            new FlatButton(
                color: Colors.white,
                shape: buttomShape,
                onPressed: () {
                  Navigator.of(context).pushNamed("/withdrawLists");
                },
                child: new Text(
                  "提现记录",
                  style: TextStyle(color: Colors.redAccent),
                ))
          ],
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
        ),
        decoration: BoxDecoration(
            color: Colors.yellow, borderRadius: BorderRadius.circular(10.0)),
        height: 100.0,
        padding: EdgeInsets.all(20.0),
      ),
      padding: EdgeInsets.only(top: 20.0, right: 10, left: 10),
    );
  }

  //提现
  Widget _withdrawCard() {
    return new Container(
      margin: EdgeInsets.all(10.0),
      alignment: Alignment.centerLeft,
      decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(5.0),
          boxShadow: [
            BoxShadow(
              color: Colors.black26,
              offset: Offset(0, -0.1),
            ),
          ]),
      padding: EdgeInsets.only(top: 10.0, right: 10, left: 10, bottom: 10.0),
      child: new Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          new Text(
            "提现金额",
            style: TextStyle(fontSize: 17.0),
          ),
          new Container(
            height: 60.0,
            padding: EdgeInsets.all(10.0),
            child: TextField(
              inputFormatters: [WhitelistingTextInputFormatter.digitsOnly],//只允许输入数字
              autofocus: false,
              keyboardType: TextInputType.number,
              decoration: InputDecoration(
                contentPadding: EdgeInsets.all(-3),
                border: InputBorder.none,
                hintText: "请输入提现金额",
              ),
            ),
            decoration: BoxDecoration(
              border: Border(bottom: BorderSide(color: Color.fromRGBO(101, 93, 29, 0.1),width:1)),
            ),
          ),
          new SizedBox(
            height: 10.0,
          ),
          new Text("最低提现金额5元",style: TextStyle(
            color: Colors.redAccent,
            fontSize: 12.0
          ),)
        ],
      ),
    );
  }

  //说明
  Widget _explainCard() {
    return new Container(
      margin: EdgeInsets.all(10.0),
      alignment: Alignment.centerLeft,
      decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(5.0),
          boxShadow: [
            BoxShadow(
              color: Colors.black26,
              offset: Offset(0, -0.1),
            ),
          ]),
      padding: EdgeInsets.only(top: 10.0, right: 10, left: 10, bottom: 10.0),
      child: new Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          new Row(
            children: <Widget>[
              Container(
                width: 20.0,
                height: 20.0,
                child: new CircleAvatar(
                  child: Text("1",style: TextStyle(
                    fontSize: 12.0
                  ),),
                ),
              ),
              new SizedBox(width: 5.0,),
              Text("最低提现5元")
            ],
          ),
          new SizedBox(height: 10.0,),
          new Row(
            children: <Widget>[
              Container(
                width: 20.0,
                height: 20.0,
                child: new CircleAvatar(
                  child: Text("2",style: TextStyle(
                      fontSize: 12.0
                  ),),
                ),
              ),
              new SizedBox(width: 5.0,),
              Text("最低提现5元")
            ],
          )
        ],
      ),
    );
  }
}
